/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package SYSGEST.br.Saida;

import java.util.ArrayList;
import java.util.List;
import javax.swing.table.AbstractTableModel;

/**
 *
 * @author Mesopotanea
 */
public class SaidaModel extends AbstractTableModel{
    List<Saida> saida = new ArrayList<Saida>();
   private String[] saidaColum = {"Codigo","Codigo de Barras","Produto", "Quantidade"};
    
    
    public SaidaModel(List <Saida> saidas){
        this.saida.clear();
        this.saida.addAll(saidas);
    }

       

    @Override
    public int getRowCount() {
        return saida.size();
    }

    @Override
    public int getColumnCount() {
        return saidaColum.length;
    }

  
    

    @Override
   public Object getValueAt(int rowIndex, int columnIndex){
       Saida sd = saida.get(rowIndex);
       switch(columnIndex){
           case 0:
               return sd.getProd().getCodigo();
            case 1:
               return sd.getProd().getCodBarras();
           case 2: 
               return sd.getProd().getProduto();
           case 3:
               return sd.getQtdSaida();
         
           
            
       }
       return null;
   }
    @Override
       public String getColumnName(int column){
           
          switch(column){
           case 0:
               return saidaColum[0];
           case 1: 
               return saidaColum[1];
           case 2:
               return saidaColum[2];
           case 3:
               return saidaColum[3];
       }
          return null;
       }
    
    
}

